package rocket.pokemon;

import java.util.ArrayList;
import rocket.logs.Write;
import rocket.logs.WriteType;

/**
 * @author justin
 * @version
 * creates an instance of a pokemon
 */
public class Pokemon {
	
	private String name;

	private String nickname;
	
	private Long trainerID;
	
	private Long pokemonID;
	
	private Type[] type;
	
	private Integer[] baseStats;
	
	private Integer level;
	//Changing status to arraylist for sake of ease.
	//private Status[] currentStatus;
	
	private ArrayList<Status> currentStatus;
	
	private Integer[] currentStats;
	
	/**
	 * POKEMON!!
	 * @param name
	 * @param nickname
	 * @param tID
	 * @param pID
	 * @param types
	 * @param baseStats
	 * @param level
	 */
	public Pokemon(String name, String nickname, Long tID, Long pID, Type[] types, Integer[] baseStats, Integer level){
		this.name = name;
		this.nickname = nickname;
		this.trainerID = tID;
		this.pokemonID = pID;
		this.type = new Type[types.length];
		//this.type;
		
		for (int i = 0; i < types.length; i++){
			type[i] = types[i];
		}
		
		this.baseStats = new Integer[baseStats.length];
		for (int i = 0; i < types.length; i++){
			this.baseStats[i] = baseStats[i];
		}
		this.level = level;
		currentStatus = new ArrayList<Status>();
	}
	
	/**
	 * 
	 */
	public void clearStatus(){
		currentStatus.clear();
	}
	
	/**
	 * @param s
	 */
	public void addStatus(Status s){
		currentStatus.add(s);
	}
	
	/**
	 * @param s
	 */
	public void removeStatus(Status s){
		currentStatus.remove(s);
	}
	
	/**
	 * @param s
	 */
	public void setStats(Integer[] s){
		currentStats = new Integer[s.length];
		for (int i = 0; i < s.length; i++){
			currentStats[i] = s[i];
		}
	}
	
	/**
	 * @return name
	 */
	public String getName(){
		return name;
	}
	
	/**
	 * @return nickname
	 */
	public String getNickname(){
		return nickname;
	}
	
	/**
	 * @return trainerID
	 */
	public Long getTID(){
		return trainerID;
	}
	
	/**
	 * @return pokemonID
	 */
	public Long getPID(){
		return pokemonID;
	}
	
	/**
	 * @return type
	 */
	public Type[] getTypes(){
		return type;
	}
	
	/**
	 * @return baseStats
	 */
	public Integer[] getBaseStats(){
		return baseStats;
	}
	
	/**
	 * @return
	 */
	public Integer getLevel(){
		return level;
	}

	/**
	 * @return
	 */
	public Integer[] getCurrentStats(){
		return currentStats;
	}
	
	/**
	 * @return currentStatus
	 */
	public ArrayList<Status> getCurrentStatus(){
		return currentStatus;
	}
	
	/**
	 * @param s
	 */
	public static void writeLog(String s){
		new Write(WriteType.SERVER, s);
	}
	
	public String toString(){
		return name;
	}

}
